import java.util.*;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void func(String s1, String s2) {
        s1 = s1.toUpperCase();
        s2 = s2.toUpperCase();
        Set<Character> set = new HashSet<>();
        Set<Character> set2 = new HashSet<>();
        for (int i = 0; i < s2.length(); i++) {
            char ch = s2.charAt(i);
            set.add(ch);
        }
        for (int i = 0; i < s1.length(); i++) {
            char ch = s1.charAt(i);
            if(!set.contains(ch) && !set2.contains(ch)) {
                set2.add(ch);
                System.out.print(ch);
            }
        }

    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String s1 = in.nextLine();
            String s2 = in.nextLine();
            func(s1, s2);
        }
    }
}